{template 'common/header'}
<style>
    a:hover {
        color: white;
        text-decoration: underline;
    }
</style>
<script>
    $(function(){
        $(".find").on('click',function(){
            find();
        });
        $(".clear-day").on('click',function(){
            $("#order_day").val('');
        })
    });
    function find(){
        var key_word = $("#key_word").val();
        var order_day = $("#order_day").val();
        var server_id = $("#server_id").val();
        location.href="{php echo $this->createWebUrl('deliver')}&express_status={$express_status}&key_word="+key_word+"&order_day="+order_day+"&server_id="+server_id+"&find=1";
    }
</script>
<ul class="nav nav-tabs">
    <li {if $express_status == 0} class="active" {/if}><a href="{php echo $this->createWebUrl('deliver', array('op'=>'index'))}">未发货</a></li>
    <li {if $express_status == 1} class="active" {/if}><a href="{php echo $this->createWebUrl('deliver', array('op'=>'index','express_status' => 1))}">已发货</a></li>
</ul>
<div>
    <dvi class="row">

        <div class="col-xs-2">
            <input type="text" class="form-control" placeholder="客户名称/助记码/电话" id="key_word" value="{$key_word}" />
        </div>
        <div class="col-xs-4">
            <div class="col-xs-4">订单日期</div>
            <div class="col-xs-8"><input type="date" class="form-control" id="order_day" value="{$order_day}" />
            </div>
        </div>
        <div class="col-xs-2">
            <button class="btn btn-default clear-day">清除日期</button>
        </div>
        <div class="col-xs-2">
            <select class="form-control" id="server_id">
                <option value="0">到货区域</option>
                {loop $servers $server}
                <option value="{$server['id']}" {if $server_id == $server['id']} selected="selected" {/if}>{$server['name']}</option>
                {/loop}
            </select>
        </div>
        <div class="col-xs-2">
            <button class="btn btn-primary find">搜索</button>
        </div>
    </dvi>
    <br />
    <br />
    {if $express_status == 0}
    <div>
        {loop $list $l}
        <a href="{php echo $this->createWebUrl('deliver',array('op' => 'detail', 'id' => $l['id'],'express_status' => $express_status,'region_id' => $server_id ))}">
            <div class="panel panel-primary" order_id="{$l['id']}">
                <div class="panel-heading">
                    <div class="panel-title row">
                        <div class="col-xs-4">{$l['name']}</div>
                        <div class="col-xs-4">
                            电话
                            <a href="tel:{$l['phone']}">
                                {$l['phone']}
                            </a>
                        </div>
                        <div class="col-xs-4">{$l['day']}</div>

                    </div>

                </div>
            </div>
        </a>
        {/loop}
        <div>{$pager}</div>
    </div>
    {else if $express_status == 1}
    <div>
        <table class="table">
            <tr>
                <th>客户</th>
                <th>电话</th>
                <th>服务社</th>
                <th>发货日期</th>
                <th>总件数</th>
                <th>总运费</th>
                <th>代付款</th>
                <th>订单日期</th>
                <th>备注</th>
            </tr>
            {loop $list $l}
            <tr>
                <td>{$l['name']}</td>
                <td>{$l['phone']}</td>
                <td>{$l['server']}</td>
                <td>{$l['deliver_day']}</td>
                <td>{$l['numbers']}</td>
                <td>{$l['total_freight']}</td>
                <td>{$l['gen_pay']}</td>
                <td>{$l['day']}</td>
                <td>{$l['remark']}</td>
            </tr>
            {/loop}
        </table>
        <div>{$pager}</div>
    </div>
    {/if}
</div>




{template 'common/footer'}